package com.zjhhsd.blackJack.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private SessionInterceptor sessionInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(sessionInterceptor).addPathPatterns("/**").
                excludePathPatterns("/").
                excludePathPatterns("/login").//不拦截登录界面
                excludePathPatterns("/register").//不拦截注册
                excludePathPatterns("/css/**"). //不拦截css样式表
                excludePathPatterns("/fonts/**").//不拦截字体样式
                excludePathPatterns("/js/**").//不拦截js文件
                excludePathPatterns("/img/**")//不拦截图像资源
                ;
    }
}

